package com.yuw.datatype;

import org.junit.Test;

public class TestDriver {

    @Test
    public void test01() {
        byte b1 = 0;
        byte b2 = 1;
        int b3 = b1 + b2;
    }

    @Test
    public void test02() {
        int i1 = 1;
        int i2 = 2;
        int b3 = i1++ + i2;
    }


    @Test
    public void test03() {
        int i1 = 0;
        System.out.println("i1++=" + (i1++) + ";i1=" + i1);
        i1 = 0;
        System.out.println("++i1=" + (++i1) + ";i1=" + i1);
    }

    @Test
    public void test04() {
        int i0 = 0, i1 = 1, i2 = 2, i3 = 3, i4 = 4, i5 = 5;
        boolean isOK1 = i0++ > i1-- && ++i2 > --i3;
        System.out.println("i0=" + i0 + " i1=" + i1 + " i2=" + i2 + " i3=" + i3);

    }

    @Test
    public void test04_2() {
        int i0 = 0, i1 = 1, i2 = 2, i3 = 3, i4 = 4, i5 = 5;
        boolean isOK1 = ++i0 >= i1-- || ++i2 < --i3;
        System.out.println("i0=" + i0 + " i1=" + i1 + " i2=" + i2 + " i3=" + i3);

    }

    @Test
    public void test05() {
        int i1 = -1; // 1001(原码) --> 1111 (补码)
        int i2 = ~i1; // 在补码的基础上进行运算 --> 0000 (补码)
        System.out.println("i2=" + i2);
    }
    @Test
    public void test05_2() {
        int i1 = -2; // 1000 0010(原码) --> 1111 1110 (补码)
        int i2 = ~i1; // 在补码的基础上进行运算 --> 0000 0001 (补码)
        System.out.println("i2=" + i2);
    }

}
